/**
 * Copyright (c) 2010 - 2018 Allinpay. All rights reserved.
 */
package com.allinpay.springBoot.springboot.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;

import com.google.gson.Gson;

/**
 * TODO: 
 *
 * @author tangjun
 * @date 2018年7月20日
 */
@Component
public class MessageSourceUtil {

	@Autowired
	private MessageSource messageSource;

	/**
	 * 根据code获取对应国际化文件信息
	 * 
	 * @param code
	 * @return
	 */
	public String getMsg(String code) {
		return messageSource.getMessage(code, new Object[] {}, LocaleContextHolder.getLocale());
	}

}
